main: Only call gjs_dumpstack() on warnings from main thread
The mozjs code called by gjs_dumpstack() does not appear to be thread
safe and was sometimes resulting in crashes when triggered by error
messages from threads other than the main thread. And even when not
crashing, such a backtrace can only be misleading since only the main
thread is executing JS code.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4046>
(cherry picked from commit
23e3e7970f1ef316c0a5bce2dea4872cf1ca5750)